<extend name="Layout:layout_content" />
<block name="body_main">
    <ul class="xsui-breadcrumb">
        <li><a href="{:U('attr_list')}"><i  class="fa fa-home fa-fw"></i>属性管理</a></li>
        <li class="current">编辑[{$data.title}]</li>
    </ul>
    <h3 class="htitle">编辑属性--[{$data.title}]</h3>
    <form action="{:U('attr_edit_save')}" method="post" class="xsui-form">
        <fieldset>
            <div class="xsui-form-field">
                <label>字段标题：</label>
                <input type="text" name="title" placeholder="属性标题"  value="{$data.title}" required="required" data-check-url="{:U('check_attr_title')}" />
                <span class="xsui-form-field-tip">(中文或英文,用于前台显示)</span>
            </div>
            <if condition="in_array($data['options_input_type'],array('select','radio','checkbox'))">
                <div class="xsui-form-field">
                    <div style="margin-bottom:5px;"><label>配置内容：</label>(多个可选值以英文分号隔开,如：是;否;不确定)</div>
                    <textarea cols="45" rows="3" name="options_content" placeholder="内容格式：是;否;不确定">{$data.options_content}</textarea>
                </div>
            </if>
            <div class="xsui-form-field">
                <label>是否表单填写：</label>
                <input type="checkbox" name="is_form" value="Y" data-value="{$data.is_form}"/>
            </div>
            <div class="xsui-form-field">
                <label>是否在表格中显示：</label>
                <input type="checkbox" name="is_list" value="Y" data-value="{$data.is_list}"/>
            </div>
            <div class="xsui-form-field">
                <label>是否允许搜索：</label>
                <input type="checkbox" name="is_search" value="Y" data-value="{$data.is_search}"/>
            </div>
            <div class="xsui-form-field">
                <label>是否导入字段：</label>
                <input type="checkbox" name="is_import" value="Y" data-value="{$data.is_import}"/>
                <span class="xsui-form-field-tip">(Excel第一行的标题必须与 [字段标题] 一致!)</span>
            </div>
            <div class="xsui-form-field">
                <label>是否导出字段：</label>
                <input type="checkbox" name="is_export" value="Y" data-value="{$data.is_export}"/>
            </div>
            <div class="xsui-form-field">
                <label>是否在来电弹屏表单显示：</label>
                <input type="checkbox" name="is_popup" value="Y" data-value="{$data.is_popup}"/>
            </div>
            <div class="xsui-form-field">
                <label>是否可用：</label>
                <sohtml:radio name="status" items="1:可用;0:禁用" value="{$data.status}" required="required" />
            </div>
        </fieldset>        
        <fieldset class="xsui-switch-fieldset">
            <legend><span class="xsui-switch">[+]</span>更多属性</legend>
            <div class="xsui-switch-content xsui-hidden">
                <div class="xsui-form-field">
                    <label>属性分组：</label>
                    <input type="text" name="group_name" value="{$data.group_name}" placeholder="属性分组" required="required" />
                    <span class="xsui-form-field-tip">(如：基本资料、联系方式)</span>
                </div>
                <div class="xsui-form-field">
                    <label>帮助提示：</label>
                    <input type="text" name="help_text" value="{$data.help_text}" placeholder="帮助提示" size="30" />
                    <span class="xsui-form-field-tip">(如有填写,则界面上鼠标划过会显示帮助提示)</span>
                </div>
                <div class="xsui-form-field">
                    <label>字段备注：</label>
                    <input type="text" name="field_comment" value="{$data.field_comment}" placeholder="字段备注" size="30" />
                    <span class="xsui-form-field-tip">(对字段的辅助描述,不会显示在界面上)</span>
                </div>
                <div class="xsui-form-field">
                    <label>字段默认值：</label>
                    <input type="text" name="field_default" placeholder="字段默认值" data-value="{$data.field_default}"/>
                </div>
            </div>
        </fieldset>
        <button type="submit" class="ui-state-default"><i class="fa fa-save"></i>保存</button>
        <button type="reset" class="ui-state-default">重置</button>
        <input type="hidden" name="id" value="{$data.id}"/>
    </form>    
</block>
<block name="body_after">
    <script type="text/javascript">
        $(':checkbox').each(function () {
            var $chk = $(this);
            if ($chk.val() == $chk.data('value')) {
                $chk.prop('checked', true);
            }
        })
    </script>
</block>